*{

Pagination thingie,
based on http://groups.google.com/group/play-framework/browse_thread/thread/32f9e6f5ff6152a6?pli=1

The main argument needs to be a paginationinfo object,
use like #{pagination paginationInfo /}

Look at that class to see how it's members affect this output.

Optional arguments:
- id:       []   an id for the div wrapped around
- first:    [<<] label for the "first" link
- last:     [>>] label for the "last" link
- previous: [<]  label for the "previous" link
- next:     [>]  label for the "next" link
- radius:   [4]  how many pages to display left/right of the current page
- clazz:    []   additional css class for outer div, the "pagination" class is always added.

}*
<div class="pagination ${_clazz}" id="${_id}">
    %{
    def page = {
    args = new java.util.HashMap<String, Object>()
    args.put('page', it)
    //args.put('zip', params.get( "zip" ) )
    _arg.params.each{ p -> args.put( p, params.get( p ) ) }

    play.mvc.Router.getFullUrl(_arg.action, args)
    }
    pageCount    = _arg.getNumPages();
    first        = (_first == null || _first == '') ? '&laquo;' : _first;
    previous     = (_previous == null || _previous == '') ? '&lsaquo;' : _previous;
    next         = (_next == null || _next == '') ? '&rsaquo;' : _next;
    last         = (_last == null || _last == '') ? '&raquo;' : _last;
    radius		 = (_radius == null )? 4 : _radius;
    path = _arg.applicationPath;

    if (_arg.page > 1) {
    out.println('<a class="first" rel="1" href="' + page(1) +'">' + '<img src="'+ path + 'public/images/common/icons/first.ico"/>' + '</a>');
    out.println('<a class="previous" rel="' + (_arg.page-1) + '" href="' + page(_arg.page - 1) + '">' + '<img src="'+ path + 'public/images/common/icons/previous.ico"/>' + '</a>');
    }
    for (int i = Math.max( 1, _arg.getPage() - radius ); i <= Math.min( pageCount, _arg.getPage() + radius ); i++) {
    if (i != _arg.getPage() ){
    out.println('<a rel="' + i + '" href="' + page(i) + '">' + i + '</a>' );
    }
    else {
    if (pageCount > 1){
    out.println('<span class="current">' + i +'</span>');
    }
    }
    }

    if (_arg.page < pageCount) {
    out.println('<a class="next" rel="' + i + '" href="' + page(_arg.getPage() + 1) + '">' + '<img src="'+ path + 'public/images/common/icons/next.ico"/>' + '</a>');
    out.println('<a class="last" rel="' + i + '" href="' + page(pageCount) + '">' + '<img src="'+ path + 'public/images/common/icons/last.ico"/>' +'</a>');
    }
    }%
</div>